package tech.lq0.dreamaticvoyage.item.fukamizutech.tool.tier1;

import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tech.lq0.dreamaticvoyage.item.fukamizutech.tool.BaseMultitool;
import tech.lq0.dreamaticvoyage.tiers.ModItemTier;
import tech.lq0.dreamaticvoyage.tools.ModTags;

import java.util.List;

public class FukamizuBreadMultitool extends BaseMultitool {

    public FukamizuBreadMultitool() {
        super(ModItemTier.FUKAMIZU_BREAD, 5.0F, -2.4F, new Item.Properties().fireResistant().durability(2020));
    }

    @Override
    public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltipComponents, TooltipFlag pIsAdvanced) {
        pTooltipComponents.add(Component.translatable("des.dreamaticvoyage.fukamizu_bread_multitool").withStyle(ChatFormatting.GRAY));
    }

    @Override
    public float getDestroySpeed(@NotNull ItemStack stack, @NotNull BlockState state) {
        if (state.is(Blocks.COBWEB) || state.is(ModTags.Blocks.FUKAMIZU_BREAD)) {
            return 15.0F;
        } else {
            return super.getDestroySpeed(stack, state);
        }
    }

    @Override
    public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
        return super.canApplyAtEnchantingTable(stack, enchantment) && enchantment != Enchantments.MENDING;
    }

}
